package com.p.lib.widget.fontview.textview;

import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;

import com.p.lib.app.BaseApplication;

/**
 * 圆体的TextView
 * @author plane
 *
 */
public class FontTextView_B extends android.support.v7.widget.AppCompatTextView{
	private static Typeface yuanti;
	public static Typeface getYuanti(Context context) {
		if(yuanti == null){
//			yuanti = Typeface.createFromAsset(context.getResources().getAssets(), "fonts/Lantinghei_b.ttf");

			if(BaseApplication.isEnglish()){
				yuanti = Typeface.createFromAsset(context.getResources().getAssets(), "fonts/SFUITextCondensed-Semibold.otf");
			}else{
				yuanti = Typeface.createFromAsset(context.getResources().getAssets(), "fonts/Lantinghei_b.ttf");
			}

		}
		return yuanti;
	}

	public static void reset(){
		yuanti = null;
	}

	public FontTextView_B(Context context) {
		this(context, null);
	}

	public FontTextView_B(Context context, AttributeSet attrs) {
		this(context, attrs, 0);
	}

	public FontTextView_B(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		this.setTypeface(getYuanti(context));
	}
}
